
import 'package:flutter/material.dart';

extension ColorExtends on Color {
  /// 根据 [amount ] 将颜色转换为较深的颜色
  Color darken([double amount = 0.1]) {
    final hsl = HSLColor.fromColor(this);
    final adjusted = hsl.withLightness((hsl.lightness - amount).clamp(0.0, 1.0));
    return adjusted.toColor();
  }
}
